import { defineComponent } from "vue";
import { EffectType } from "../../../../enums/messageEnum";
import { getDictList } from "@/utils/cacheUtil";
export default defineComponent({
	props: {
		modelValue: [String, Number]
	},
	emits: [],
	setup(props) {
		const level = ref();
		let type = ref();
		onMounted(async () => {
			level.value = (await getDictList("warning_level")).find((item: any) => item.key == props.modelValue);
			switch (level.value?.key) {
				case 1:
					type.value = EffectType.success;
					break;
				case 2:
					type.value = EffectType.info;
					break;
				case 3:
					type.value = EffectType.warning;
					break;
				case 4:
					type.value = EffectType.danger;
					break;
			}
		});
		return () => {
			return level.value ? <el-tag type={type.value}>{level.value?.label}</el-tag> : "";
		};
	}
});
